﻿namespace TI_BLE_HCI_ClientLib.HCIBaseEntities
{
    public enum HCIEventEventCode
    {
        LE_Event = 0x3E,
        HCI_LE_ExtEvent = 0xFF
    }

    public enum HCIEventSubeventCode
    {
        LE_ConnectionComplete = 0x01,
        LE_AdvertisingReport = 0x02,
        LE_ConnectionUpdateComplete = 0x03,
        LE_ReadRemoteUsedFeaturesComplete = 0x04,
        LE_LongTermKeyRequested = 0x05
    }

    public enum HCIVendorSpecificEventEOGF
    {
        EmbeddedOpcode = 0,
        CoreOpcode = 1,
        ProfileRequest = 2,
        ProfileResponse = 3
    }

    public enum HCIVendorSpecificEventESG
    {
        HCI = 0,
        L2CAP = 1,
        ATT = 2,
        GAP = 4
    }

    public enum HCIVendorSpecificEventHostErrorCode
    {
        Success = 0x0,
        Failure = 0x1,
        InvalidParameter = 0x2,
        InvalidTask = 0x3,
        bleNotReady=0x10,
        bleAlreadyInRequestedMode=0x11,
        bleProcedureComplete=0x1a,
        InvalidHCICommandParameters=0x12,
        blePending=0x16,
        bleInvalidPDU=0x40
        // TODO Completare con tabella pag.159 (sez.[20]) specifiche TI BLE Vendor Specific HCI Guide
    }

    public enum HCIVendorSpecificEventEventOpcode
    {
        HCIEXT_SystemReset = (HCIVendorSpecificEventEOGF.CoreOpcode << 10) + (HCIVendorSpecificEventESG.HCI << 7) + 29,
        GAP_HCI_Extension_CommandStatus = (HCIVendorSpecificEventEOGF.CoreOpcode << 10) + (HCIVendorSpecificEventESG.GAP << 7) + 127,
        GAP_Device_Init_Done = (HCIVendorSpecificEventEOGF.CoreOpcode << 10) + (HCIVendorSpecificEventESG.GAP << 7) + 0,
        GAP_Device_Information = (HCIVendorSpecificEventEOGF.CoreOpcode << 10) + (HCIVendorSpecificEventESG.GAP << 7) + 13,
        GAP_Device_Discovery_Done = (HCIVendorSpecificEventEOGF.CoreOpcode << 10) + (HCIVendorSpecificEventESG.GAP << 7) + 1,
        GAP_Link_Established = (HCIVendorSpecificEventEOGF.CoreOpcode << 10) + (HCIVendorSpecificEventESG.GAP << 7) + 5,
        GAP_Link_Terminated = (HCIVendorSpecificEventEOGF.CoreOpcode << 10) + (HCIVendorSpecificEventESG.GAP << 7) + 6,
        GAP_Advert_Data_Update_Done = (HCIVendorSpecificEventEOGF.CoreOpcode << 10) + (HCIVendorSpecificEventESG.GAP << 7) + 2,
        GAP_Authentication_Complete = (HCIVendorSpecificEventEOGF.CoreOpcode << 10) + (HCIVendorSpecificEventESG.GAP << 7) + 10,
        GAP_Make_Discoverable_Done = (HCIVendorSpecificEventEOGF.CoreOpcode << 10) + (HCIVendorSpecificEventESG.GAP << 7) + 3,
        GAP_End_Discoverable_Done = (HCIVendorSpecificEventEOGF.CoreOpcode << 10) + (HCIVendorSpecificEventESG.GAP << 7) + 4,

        ATT_Error_Response = (HCIVendorSpecificEventEOGF.CoreOpcode << 10) + (HCIVendorSpecificEventESG.ATT << 7) + 1,
        ATT_Exchange_MTU_Request = (HCIVendorSpecificEventEOGF.CoreOpcode << 10) + (HCIVendorSpecificEventESG.ATT << 7) + 2,
        ATT_Exchange_MTU_Response = (HCIVendorSpecificEventEOGF.CoreOpcode << 10) + (HCIVendorSpecificEventESG.ATT << 7) + 3,
        ATT_Read_Characteristic_Value_Response = (HCIVendorSpecificEventEOGF.CoreOpcode << 10) + (HCIVendorSpecificEventESG.ATT << 7) + 11,
        ATT_Write_Characteristic_Value_Response = (HCIVendorSpecificEventEOGF.CoreOpcode << 10) + (HCIVendorSpecificEventESG.ATT << 7) + 19,
        ATT_Handle_Value_Notification = (HCIVendorSpecificEventEOGF.CoreOpcode << 10) + (HCIVendorSpecificEventESG.ATT << 7) + 27,
        ATT_Handle_Value_Indication = (HCIVendorSpecificEventEOGF.CoreOpcode << 10) + (HCIVendorSpecificEventESG.ATT << 7) + 29,
        ATT_Handle_Value_Indication_Confirmation = (HCIVendorSpecificEventEOGF.CoreOpcode << 10) + (HCIVendorSpecificEventESG.ATT << 7) + 30,
        ATT_Read_Characteristic_Value_Request = (HCIVendorSpecificEventEOGF.CoreOpcode << 10) + (HCIVendorSpecificEventESG.ATT << 7) + 10,
        ATT_Write_Characteristic_Value_Request = (HCIVendorSpecificEventEOGF.CoreOpcode << 10) + (HCIVendorSpecificEventESG.ATT << 7) + 18,
        ATT_Prepare_Write_Characteristic_Value_Request = (HCIVendorSpecificEventEOGF.CoreOpcode << 10) + (HCIVendorSpecificEventESG.ATT << 7) + 22,
        ATT_Read_By_Group_Type_Request = (HCIVendorSpecificEventEOGF.CoreOpcode << 10) + (HCIVendorSpecificEventESG.ATT << 7) + 16,
        ATT_Find_By_Type_Value_Request = (HCIVendorSpecificEventEOGF.CoreOpcode << 10) + (HCIVendorSpecificEventESG.ATT << 7) + 6,
        ATT_Read_By_Type_Request = (HCIVendorSpecificEventEOGF.CoreOpcode << 10) + (HCIVendorSpecificEventESG.ATT << 7) + 8,
        ATT_Read_Characteristic_Blob_Value_Request = (HCIVendorSpecificEventEOGF.CoreOpcode << 10) + (HCIVendorSpecificEventESG.ATT << 7) + 12,

    }
}